#!/bin/sh
# - pagesize

. $LKP_SRC/lib/env.sh
. $LKP_SRC/lib/debug.sh
. $LKP_SRC/lib/reproduce-log.sh

cd $BENCHMARK_ROOT/libhugetlbfs-test || die "can not cd libhugetlbfs-test"

log_cmd make $make_opt || die "make failed"

[ -z $pagesize ] && die "invalid parameter"

# in order to config huge pages size and number
log_cmd obj/hugeadm --add-temp-swap=32 --pool-pages-min $pagesize:32 --hard \
	|| die "config huge pages size and number failed"

log_cmd make $make_opt check

# replace the full-width characters with half-width to avoid the stderr.json
# eg.
# before sed: shmoverride_unlinked.c: In function ‘local_read_meminfo’:
# after sed: shmoverride_unlinked.c: In function 'local_read_meminfo':
[ -s $TMP/stderr ] && sed -i "s/‘\|’/'/g" $TMP/stderr

exit 0
